]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/keyboard: Ignore purpose hint changes while keymap switcher is shown
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 11 Nov 2022 12:13:41 +0000 (13:13 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 5 Dec 2022 14:50:33 +0000 (14:50 +0000)
If we are getting purpose hint changes while the language switcher is popped
up, this likely means the purpose hint was actually triggered by the key
focus change induced by the language switcher popping up.

In this case, we on one hand would like to preserve the state that applied
before thise focus change, and on the other we very much want to avoid the
keymap change that would forget about the keys being pressed.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6066
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2534>

js/ui/status/keyboard.js

index 82706c0389c7346af7a8052703aca42ee29c324c..b47375d6442ee03930381dfdb0723221e691c279 100644 (file)
@@ -411,9 +411,14 @@ var InputSourceManager = class extends Signals.EventEmitter {
             return;
         }
 
-        let popup = new InputSourcePopup(this._mruSources, this._keybindingAction, this._keybindingActionBackward);
-        if (!popup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
-            popup.fadeAndDestroy();
+        this._switcherPopup = new InputSourcePopup(
+            this._mruSources, this._keybindingAction, this._keybindingActionBackward);
+        this._switcherPopup.connect('destroy', () => {
+            this._switcherPopup = null;
+        });
+        if (!this._switcherPopup.show(
+            binding.is_reversed(), binding.get_name(), binding.get_mask()))
+            this._switcherPopup.fadeAndDestroy();
     }
 
     _keyboardOptionsChanged() {
@@ -675,6 +680,10 @@ var InputSourceManager = class extends Signals.EventEmitter {
     }
 
     _ibusSetContentType(im, purpose, _hints) {
+        // Avoid purpose changes while the switcher popup is shown, likely due to
+        // the focus change caused by the switcher popup causing this purpose change.
+        if (this._switcherPopup)
+            return;
         if (purpose == IBus.InputPurpose.PASSWORD) {
             if (Object.keys(this._inputSources).length == Object.keys(this._ibusSources).length)
                 return;